<?php
/**
 * Created by PhpStorm.
 * User: castle
 * Date: 15-4-13
 * Time: 下午8:49
 */
namespace Repair\Model;
use Think\Model;

class AccessoriesModel extends  Model{
    protected $_map = array(
        'AccessoriesID'=>'accessoriesid',
'Name'=>'name',
'Model'=>'model',
'Number'=>'number',

	);
	//获取单个信息
    function get($AccessoriesID){
        //此处要判断是否有APPID，如果有APPID则在此处加上APPID相关信息
        if(is_numeric($AccessoriesID)){return $this->where(array('AccessoriesID'=>$AccessoriesID,))->find();}return false;
    }
    //获取所有信息
    function gets($AccessoriesID = false){
        if(false === $AccessoriesID ){
            return $this->where(array())->cache(7200)->select();
        }else if(is_array($AccessoriesID)){
            return $this->where('AccessoriesID in ('.implode(',',$AccessoriesID).')')->select();
        }else{
            return false;
        }
    }
    function del($AccessoriesID){
        if(is_array($AccessoriesID)){
            $where = 'AccessoriesID in ('.implode(',',$AccessoriesID).')';
        }else if(is_string($AccessoriesID)){
            $where = 'AccessoriesID in ('.explode(',',$AccessoriesID).')';
        }else{
            return false;
        }
        if($this->where($where)->delete()){
            return true;
        }else{
           return false;
        }
    }
    function addAccessories($Name,$Model,$Number){
        return $this->add($_POST);
    }
}
?>
